#lang sicp

(define (double x)
  (+ x x))

(define (halve x)
  (quotient x 2))

(define (multiply a b)
  (cond ((= b 0) 0)
        ((odd? b) (+ a (multiply (double a) (halve b))))
        (else (multiply (double a) (halve b)))))